<?php 
include_once './sys/com/model/db/ProdTypeDAO.php';
include_once './sys/com/model/util/Util.php'; 
	function __construct() {
		@header ( "Content-Type:text/html; charset=utf-8" );
	}
?>
<?php 
$prodTypeDAO = new ProdTypeDAO();
$result = $prodTypeDAO->queryAllWithSubType();
?>
<table width="180" border="0" align="center" cellpadding="0" cellspacing="0" background="images/index_12_20.png">
	<tr>
		<td width="10"></td>
		<td>
		<table border="0" align="center" cellpadding="0" cellspacing="0">
		<?php 
		$pt_id = 0;
		for($i = 0; $i < count($result); $i++) {
			$prodType = $result[$i];
			if($pt_id != $prodType->{"pt_id"}){ //若是新大類，顯示大類名稱
				$pt_id = $prodType->{"pt_id"};

				if($i!=0 && $i+1!=count($result)){
		?>
	        		<tr><td colspan='2'><img src='images/dotsline.png' width='167' height='11' /></td></tr>
	     <?php 	}?>
	     <?php	if($i!=0){?>
	        		</td></tr>
	     <?php  			}?>
	        		<tr>
	        			<td align='center'><span class='style17'>＞</span></td>
	        			<td align='left' class='style43'><?php echo $prodType->{"type"}?></td>
	        		</tr>
	        		<tr>
	        			<td width='30' align='center'>&nbsp;</td><td width='127' align='left' class='style2'>
	     <?php }?>
	        			<a href="List_pages/product_list/product_list.php?pst_id=<?php echo $prodType->{"pst_id"}?>"><?php echo $prodType->{"sub_type"}?></a><br/>
		<?php
			}
		?>
		</table>
		</td>
		<td width="10"></td>
	</tr>
</table>